#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QMessageBox"

Mainwindow::Mainwindow(QDialog *parent) :
    QDialog(parent),
    ui(new Ui::Mainwindow)
{
    ui->setupUi(this);
    initwindow();
}

Mainwindow::~Mainwindow()
{
    delete ui;
}

void Mainwindow::initwindow()
{
    setWindowTitle("贪吃蛇");
    setWindowIcon(QIcon(":/images/images/Snake_pic"));
    setFixedSize(1100,600);

    setAutoFillBackground(true);
    QPalette palette;
    palette.setBrush(QPalette::Background, QBrush(QPixmap(":/images/images/BackGround.jpg").scaled(this->size())));
    setPalette(palette);

    ui->Start->setStyleSheet("background-color: rgb(255, 0, 0);");
    ui->Exit->setStyleSheet("background-color: rgb(255, 20, 147);");
    ui->verson->setStyleSheet("background-color: rgb(255, 52, 179);");

    /*ui->startButton->setIcon(QIcon(":/images/start_normal.png"));
    ui->startButton->setIconSize(QSize(240, 240));
    ui->startButton->setFlat(true);

    ui->leaveButton->setIcon(QIcon(":/images/quit_normal.png"));
    ui->leaveButton->setIconSize(QSize(270, 270));
    ui->leaveButton->setFlat(true);*/

}

void Mainwindow::on_Start_clicked()
{
    accept();
}

void Mainwindow::on_Exit_clicked()
{
    close();
}

void Mainwindow::on_verson_clicked()
{
   QMessageBox::information(this, QString::fromUtf8("Version"), QString::fromUtf8("DYF 1.0 2018/5/30 Thank you for using!"));
}
